/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __DRV_UART_H
#define __DRV_UART_H

#include "main.h"
#include "fsl_usart.h"

#ifdef __cplusplus
extern "C"
{
#endif

/* Includes ------------------------------------------------------------------*/

/* Private includes ----------------------------------------------------------*/


#if UART_SHELL == LETTER_SHELL
#include "shell_port.h" //letter shell
#elif UART_SHELL == NR_MICRO_SHELL
#include "nr_micro_shell.h"
#else
#error "no uart shell!!!"
#endif

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

typedef struct fifo_buffer
{
    volatile uint32_t    read_i;
    volatile uint32_t    write_i;
    uint8_t     buff[128];
}fifo_buffer;

extern fifo_buffer  shell_uart_rx;
/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */
/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
/* USER CODE BEGIN EFP */

void drv_usart_gpio_init(void);
int stdout_putchar (int ch) ;
void shell_usart_loop(void);

void USART_PutChar(uint8_t ch);
uint8_t USART_GetChar(void);

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __DRV_UART_H */

/************************ (C) COPYRIGHT CW *****END OF FILE****/


